<?php
class pluginsclass {

	function pluginsclass() {
		global $setupdata, $mysqlclass;
		$this->setupdata=$setupdata;
		$this->mysqlclass=$mysqlclass;
	}
	
	function get_all_plugins(){
		$result = array();
		if (isset($this->setupdata['modules']['plugins']['path'])){
			if (is_dir($this->setupdata['modules']['plugins']['path'])){
				$d = opendir($this->setupdata['modules']['plugins']['path']);
				while ($file = readdir($d)){
					if (is_dir($this->setupdata['modules']['plugins']['path']."/".$file)) {
						if (($file != "..") && ($file != ".")) $result[] = $file;
					}
				}
				closedir($d);
			}
		}
		return $result;
	}
	
	function get_plugin_discribe($plugin){
		$result = "";
		if (isset($this->setupdata['modules']['plugins']['path'])){
			if (file_exists($this->setupdata['modules']['plugins']['path']."/".$plugin."/readme.txt")) {
				$tmp = file($this->setupdata['modules']['plugins']['path']."/".$plugin."/readme.txt");
				$result['describtion'] = $tmp[0];
			}
			if (file_exists($this->setupdata['modules']['plugins']['path']."/".$plugin."/admin/index.html")) {
				$result['index'] = $this->setupdata['modules']['plugins']['path']."/".$plugin."/admin/index.html";
			}
		}
		return $result;
	}

}
?>
